package com.shinewind.search.service.impl;

import cn.hutool.core.util.RandomUtil;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.shinewind.pojo.entity.Model;
import com.shinewind.search.mapper.IModelMapper;
import com.shinewind.search.service.IModelService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class ModelServiceImpl extends ServiceImpl<IModelMapper, Model> implements IModelService {

    @Override
    public List<Model> getRanDomModelList() {
        //随机查询model
        List<Model> ModelList = RandomUtil.randomEleList(this.list(), 9);
        return ModelList;
    }

    @Override
    public Model getModelByMId(String mId) {
        Model model = this.lambdaQuery().eq(Model::getMId,mId).one();
        return model;
    }
}